package YAPserver.behaviours;

import java.util.Random;

import YAPserver.collisionEngine.*;

/**
 * This will handle a randomly bouncing ball
 * like a rugbyball
 * @author Daniel
 *
 */
public class BounceRandom extends BounceAbstract{

	@Override
	protected double calcNewAngle(Ball ball, Wall wall) {
		double angle;
		Random rand = new Random();
		
		angle = wall.getLine().getAngle();
		angle = angle + rand.nextDouble()*Math.PI;
		if(angle >= 2*Math.PI){
			angle = angle - 2*Math.PI;
		}
		return angle;
	}

}
